package com.yuke.cloud.service.smc.service.impl;

import com.yuke.cloud.common.core.support.BaseService;
import com.yuke.cloud.service.smc.dao.AssGoodsCancelMapper;
import com.yuke.cloud.service.smc.dao.ShopStockGoodsMapper;
import com.yuke.cloud.service.smc.dto.AssGoodsCancelDTO;
import com.yuke.cloud.service.smc.entity.AssGoodsCancel;
import com.yuke.cloud.service.smc.service.AssGoodsCancelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


/**
 * Created by wg on 2018/09/12.
 */
@Service
@Transactional
public class AssGoodsCancelServiceImpl extends BaseService<AssGoodsCancel> implements AssGoodsCancelService {
    @Resource
    private AssGoodsCancelMapper assGoodsCancelMapper;

    @Resource
    private ShopStockGoodsMapper shopStockGoodsMapper;

    @Override
    public void goodsCancle(AssGoodsCancelDTO cancelDTO){
        shopStockGoodsMapper.updateGoodsStatus(cancelDTO.getStockGoodsId(),(byte)2);
        assGoodsCancelMapper.addGoodsCancle(cancelDTO);
    }

    @Override
    public int save(AssGoodsCancel record) {

        record.setGoodsCancelId(generateId());
        return super.save(record);
    }
}

